import moment from 'moment';
import React, { useRef } from 'react';
import { createRoot } from 'react-dom/client';
import { BrowserRouter as Router } from 'react-router-dom';
import { ConfigProvider } from 'antd';
import App from 'App/index';
import zhCN from 'antd/lib/locale/zh_CN';
import rootStore from 'Core/RootStore';
import 'moment/dist/locale/zh-cn';
import './index.less';

const WrappedApp: React.FC = () => {
    const store = useRef(rootStore).current;

    return (
        <ConfigProvider locale={zhCN}>
            <App store={store} />
        </ConfigProvider>
    );
};

moment.locale('zh-cn');

createRoot(document.getElementById('root')!).render(
    <React.StrictMode>
        <Router>
            <WrappedApp />
        </Router>
    </React.StrictMode>,
);
